NumericStepper

Kind of class:class
Inherits from:UIComponent < MovieClip
Classpath:gfx.controls.NumericStepper
File last modified:Tuesday, 29 June 2010, 09:03:27
The NumericStepper component displays a single number in the range assigned to it, and supports the ability to increment and decrement the value based on an arbitrary step size.

Inspectable Properties
A MovieClip that derives from the NumericStepper component will have the following inspectable properties:
  • visible: Hides the component if set to false.
  • disabled: Disables the component if set to true.
  • value: The numeric value displayed by the NumericStepper.
  • minimum: The minimum value of the NumericStepper’s range.
  • maximum: The maximum value of the NumericStepper’s range.
  • enableInitCallback: If set to true, _global.CLIK_loadCallback() will be fired when a component is loaded and _global.CLIK_unloadCallback will be called when the component is unloaded. These methods receive the instance name, target path, and a reference the component as parameters. _global.CLIK_loadCallback and _global.CLIK_unloadCallback should be overriden from the game engine using GFx FunctionObjects.
  • soundMap: Mapping between events and sound process. When an event is fired, the associated sound process will be fired via _global.gfxProcessSound, which should be overriden from the game engine using GFx FunctionObjects.
States
The NumericStepper component supports three states based on its focused and disabled properties.
  • default or enabled state.
  • focused state, that highlights the textField area.
  • disabled state.
Events
All event callbacks receive a single Object parameter that contains relevant information about the event. The following properties are common to all events.
  • type: The event type.
  • target: The target that generated the event.
The events generated by the NumericStepper component are listed below. The properties listed next to the event are provided in addition to the common properties.
  • show: The component's visible property has been set to true at runtime.
  • hide: The component's visible property has been set to false at runtime.
  • change: The NumericStepper’s value has changed.
  • stateChange: The NumericStepper’s focused or disabled property has changed.
    • state: Name of the new state. String type. Values "default", "focused" or "disabled".
Component metadata:
    InspectableList
    "disabled"
    "enableInitCallback"
    "maximum"
    "minimum"
    "soundMap"
    "value"
    "visible"

    Summary


    Constructor
    Instance properties
    • stepSize
      • The amount the value is incremented or decremented.
    • soundMap
      • Mapping between events and sound process
    • nextBtn
      • An optional Button used to increment the value.
    • prevBtn
      • An optional Button used to decrement the value.
    • textField
      • The TextField label used to display the value.
    • maximum
      • The maximum allowed value.
    • minimum
      • The minimum allowed value.
    • value
      • The value of the numeric stepper.
    • disabled
      • Disable this component.
    • labelFunction
      • The function used to determine the label.
    Class methods
    Class methods inherited from UIComponent
    Instance methods
    • increment
      • Increment the value of the NumericStepper, using the stepSize.
    • decrement
      • Decrement the value of the NumericStepper, using the stepSize.
    • handleInput
      • Handle input from the game, via controllers or keyboard.

    Constructor

    NumericStepper

    function NumericStepper (
    )

    The constructor is called when a NumericStepper or a sub-class of NumericStepper is instantiated on stage or by using attachMovie() in ActionScript. This component can not be instantiated using new syntax. When creating new components that extend NumericStepper, ensure that a super() call is made first in the constructor.

    Instance properties

    disabled

    disabled:Boolean
    (read,write)

    Disable this component. Focus (along with keyboard events) and mouse events will be suppressed if disabled.

    labelFunction

    labelFunction:Function
    (read,write)

    The function used to determine the label.

    maximum

    maximum:Number
    (read,write)

    The maximum allowed value. The value property will always be less than or equal to the maximum.

    minimum

    minimum:Number
    (read,write)

    The minimum allowed value. The value property will always be greater than or equal to the minimum.

    nextBtn

    nextBtn:Button
    (read,write)

    An optional Button used to increment the value.

    prevBtn

    prevBtn:Button
    (read,write)

    An optional Button used to decrement the value.

    soundMap

    soundMap:Object = { theme:"default", focusIn:"focusIn", focusOut:"focusOut", change:"change" }
    (read,write)

    Mapping between events and sound process

    stepSize

    stepSize:Number = 1
    (read,write)

    The amount the value is incremented or decremented.

    textField

    textField:TextField
    (read,write)

    The TextField label used to display the value. Note that when state changes are made, the textField instance may change, so changes made to it externally may be lost.

    value

    value:Number
    (read,write)

    The value of the numeric stepper. The value property will always be kept between the mimimum and maximum.
    See also:

    Instance methods

    decrement

    function decrement (
    ) : Void

    Decrement the value of the NumericStepper, using the stepSize.

    handleInput

    function handleInput (
    details:InputDetails, pathToFocus:Array) : Boolean

    Handle input from the game, via controllers or keyboard. The default handleInput will handle standalone and composite components.
    #
    Parameters:
    details :
    An InputDetails object containing details from the interaction.
    pathToFocus:
    A list of children in the focus path that are below this component. Components are responsible for calling handleInput() on the next component in the pathToFocus unless they choose to intercept the call.

    increment

    function increment (
    ) : Void

    Increment the value of the NumericStepper, using the stepSize.